import { mapState } from 'vuex';

const mixin = {
  data() {
    return {
      total: 0,
      current: 1,
      pageSize: 15,
    };
  },
  computed: {
    ...mapState(['requesting']),
  },
  watch: {
    pageSize() {
      this.current = 1;
    },
  },
  methods: {
    handleTableChange(current) { // 页码切换
      this.current = current;
      this.getListData();
    },
    handleShowSizeChange(current, size) { // 分页条数切换
      this.total = 0;
      this.current = 1;
      this.pageSize = size;
      this.getListData();
    },
  },
};

export default mixin;
